import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ichinesereader/constants.dart';
import 'package:ichinesereader/pages/common/basicWords.dart';
import 'package:ichinesereader/routes/routePages.dart';
import 'package:ichinesereader/utils/log.dart';
import 'package:ichinesereader/widgets/layouts/appdrawerStudent.dart';
import 'package:ichinesereader/widgets/layouts/customAppBar.dart';
import 'package:ichinesereader/widgets/sidebars/studentSidebar.dart';
import '../../themes/pageStyles.dart';

class MyBasicKnowledgeWordsPage extends StatelessWidget {
  static const String routeName = '/student/basicCardList';

  @override
  Widget build(BuildContext context) {
    Log.debug('build student basic words');
    final isSmallScreen =
        MediaQuery.of(context).size.width < Constants.DefinedScreenSmallSize;
    final isBigScreen =
        MediaQuery.of(context).size.width > Constants.DefinedScreenBigSize;
    int _selectedSidebarItem = RoutePages.studentPageItems
        .indexWhere((page) => page.route == Get.currentRoute);
    final PageStyles _pageStyles = PageStyles();

    return DefaultTabController(
        length: 2,
        child: Scaffold(
          appBar:
              isSmallScreen ? CustomAppBar(title: 'Basic Word Card'.tr) : null,
          drawer: isSmallScreen ? StudentAppDrawer() : null,
          body: Container(
            decoration: _pageStyles.pageBoxDecoration(),
            child: Row(
              children: [
                Visibility(
                    visible: !isSmallScreen,
                    child: StudentSidebarX(
                        selectedIndex: _selectedSidebarItem,
                        isBigScreen: isBigScreen)),
                Expanded(
                  child: Container(
                    margin: _pageStyles.mainContainerPageEdgeInsets(),
                    child: BasicWords(),
                  ),
                ),
              ],
            ),
          ),
        ));
  }
}
